package com.igoal.service;

import java.util.Date;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.igoal.dto.NewsDTO;
import com.igoal.entity.News;

public interface NewsManager extends GenericManager<News, Long>{
	/**
	 * List news with limited record
	 * @param lastNewsCreateDate if null, get first page else get next page
	 * @return list {@link NewsDTO}
	 */
	@Transactional(readOnly=true)
	public List<NewsDTO> listNews(Date lastNewsCreateDate, boolean before);
	
	@Transactional(readOnly=false)
	public NewsDTO addNews(String username, NewsDTO dto);
	
	@Transactional(readOnly=true)
	NewsDTO loadNews(Long id);
	
	@Transactional(readOnly=true)
	NewsDTO getRandomNews();
	
	@Transactional(readOnly=false)
	NewsDTO updateNews(String username, NewsDTO dto);
}
